home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Linux Cubed Series 7: Sunsite
/
Linux Cubed Series 7 - Sunsite Vol 1.iso
/
system
/
backup
/
dds2tar-.000
/
dds2tar-2.4.12.tar
/
dds2tar-2.4.12
/
ddstool
< prev
next >
Wrap
Text File
|
1995-02-05
|
2KB
|
88 lines
#!/bin/sh
# This tool is in experimental status.
#
# Send me an email, if you have nice ideas.
# weule@uni-duesseldorf.de
#
#====================================================================
# Usage:
#
# First label a tape:
# ddstool create-label 'unique-string and more strings'
#
# To archive something:
# ddstool append pathnames...
#
# To delete the old index-files and make a new label:
# ddstool new-label 'unique-string and more strings'
#
# Each index is stored by the pathnames:
# $A/$unique-string.$file-number (soft link)
# $A/$timestamp-of-the-tapelabel.$file-number (file)
#
#====================================================================
# Sorry that I don't know the right method to extract something.
# For now it's more save to do it by hand.
#
#====================================================================
#
set -v
A=/data/tape
case "$1" in
append)
mt rewind;
L=`mt-dds label | awk '{print $1}' `
T=`mt-dds ts`
mt rewind
mt eom
mt status | grep file
F=`mt status | awk '{ if ($1 == "file") printf("%02d",$4) }'`
echo $A/$T.$F $A/$L.$F
touch $A/$T.$F
ln -f -s $A/$T.$F $A/$L.$F
shift
tar --label "$L" -b 32 -R -v -v --record-file $A/$T.$F --create $*
;;
create-label)
mt rewind
tar --create --label "$2" -b 2
;;
new-label)
mt rewind;
L=`mt-dds label | awk '{print $1}' `
T=`mt-dds ts`
mt rewind
rm $A/$L.* $A/$T.*
L=`echo "$2" | awk '{print $1}'`
if test -f $L.01 ; then
echo $0: ERROR: Label ist schon bekannt!
else
tar --create --label "$2" -b 2
mt rewind
T=`mt-dds ts`
F=00
tar -b 1 -t -v -v -R --record-file $A/$T.$F
ln -f -s $A/$T.$F $A/$L.$F
fi
;;
index)
mt rewind;
L=`mt-dds label | awk '{print $1}' `
T=`mt-dds ts`
mt rewind
B=`mt-dds blksize`
echo $B
tar -v -v -R -t -b $B --record-file $A/$T.$F
mt rewind
mt asf "$2"
F=`mt status | awk '{ if ($1 == "file") printf("%02d",$4) }'`
echo File = $F
echo $A/$T.$F $A/$L.$F
touch $A/$T.$F
ln -f -s $A/$T.$F $A/$L.$F
B=`mt-dds blksize`
echo Blksize = $B
tar -b $B -t -R -v -v --record-file $A/$T.$F
esac
mt rewind